home *** CD-ROM | disk | FTP | other *** search
/ This Disc Bytes! / Power Computing - The Disc 2 - This Disc Bytes.ISO / mac / CodeWarrior 7 Lite for 68K / MacOS Support / Headers / Universal Headers / ADSPSecure.h < prev    next >
Text File  |  1995-07-06  |  7KB  |  221 lines

  1. /*
  2.      File:        ADSPSecure.h
  3.  
  4.      Contains:    Secure AppleTalk Data Stream Protocol Interfaces.
  5.  
  6.      Version:    Technology:    AOCE Toolbox 1.02
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __ADSPSECURE__
  21. #define __ADSPSECURE__
  22.  
  23.  
  24. #ifndef __EVENTS__
  25. #include <Events.h>
  26. #endif
  27. /*    #include <Types.h>                                            */
  28. /*        #include <ConditionalMacros.h>                            */
  29. /*    #include <Quickdraw.h>                                        */
  30. /*        #include <MixedMode.h>                                    */
  31. /*        #include <QuickdrawText.h>                                */
  32. /*    #include <OSUtils.h>                                        */
  33. /*        #include <Memory.h>                                        */
  34.  
  35. #ifndef __NOTIFICATION__
  36. #include <Notification.h>
  37. #endif
  38.  
  39. #ifndef __APPLEEVENTS__
  40. #include <AppleEvents.h>
  41. #endif
  42. /*    #include <Errors.h>                                            */
  43. /*    #include <EPPC.h>                                            */
  44. /*        #include <AppleTalk.h>                                    */
  45. /*        #include <Files.h>                                        */
  46. /*            #include <Finder.h>                                    */
  47. /*        #include <PPCToolbox.h>                                    */
  48. /*        #include <Processes.h>                                    */
  49.  
  50. #ifndef __TYPES__
  51. #include <Types.h>
  52. #endif
  53.  
  54. #ifndef __ADSP__
  55. #include <ADSP.h>
  56. #endif
  57.  
  58. #ifndef __FILES__
  59. #include <Files.h>
  60. #endif
  61.  
  62. #ifndef __OCE__
  63. #include <OCE.h>
  64. #endif
  65. /*    #include <Aliases.h>                                        */
  66. /*    #include <Script.h>                                            */
  67. /*        #include <IntlResources.h>                                */
  68.  
  69. #ifndef __OCEAUTHDIR__
  70. #include <OCEAuthDir.h>
  71. #endif
  72.  
  73. #ifdef __cplusplus
  74. extern "C" {
  75. #endif
  76.  
  77. #if PRAGMA_ALIGN_SUPPORTED
  78. #pragma options align=mac68k
  79. #endif
  80.  
  81. #if PRAGMA_IMPORT_SUPPORTED
  82. #pragma import on
  83. #endif
  84.  
  85.  
  86. enum {
  87.     sdspOpen                    = 229
  88. };
  89.  
  90. /*
  91. For secure connections, the eom field of ioParams contains two single-bit flags
  92. (instead of a zero/non-zero byte). They are an encrypt flag (see below), and an
  93. eom flag.  All other bits in that field should be zero.
  94.  
  95. To write an encrypted message, you must set an encrypt bit in the eom field of
  96. the ioParams of your write call. Note: this flag is only checked on the first
  97. write of a message (the first write on a connection, or the first write following
  98. a write with eom set.
  99. */
  100. enum {
  101.     dspEOMBit,                                                    /* set if EOM at end of write */
  102.     dspEncryptBit                                                /* set to encrypt message */
  103. };
  104.  
  105. enum {
  106.     dspEOMMask                    = 1 << dspEOMBit,
  107.     dspEncryptMask                = 1 << dspEncryptBit
  108. };
  109.  
  110. enum {
  111.     sdspWorkSize                = 2048
  112. };
  113.  
  114. struct TRSecureParams {
  115.     unsigned short                    localCID;                    /* local connection id */
  116.     unsigned short                    remoteCID;                    /* remote connection id */
  117.     AddrBlock                        remoteAddress;                /* address of remote end */
  118.     AddrBlock                        filterAddress;                /* address filter */
  119.     unsigned long                    sendSeq;                    /* local send sequence number */
  120.     unsigned short                    sendWindow;                    /* send window size */
  121.     unsigned long                    recvSeq;                    /* receive sequence number */
  122.     unsigned long                    attnSendSeq;                /* attention send sequence number */
  123.     unsigned long                    attnRecvSeq;                /* attention receive sequence number */
  124.     unsigned char                    ocMode;                        /* open connection mode */
  125.     unsigned char                    ocInterval;                    /* open connection request retry interval */
  126.     unsigned char                    ocMaximum;                    /* open connection request retry maximum */
  127.     Boolean                            secure;                        /*  --> TRUE if session was authenticated */
  128.     AuthKeyPtr                        sessionKey;                    /* <--> encryption key for session */
  129.     unsigned long                    credentialsSize;            /*  --> length of credentials */
  130.     Ptr                                credentials;                /*  --> pointer to credentials */
  131.     Ptr                                workspace;                    /*  --> pointer to workspace for connection
  132.                                            align on even boundary and length = sdspWorkSize */
  133.     AuthIdentity                    recipient;                    /*  --> identity of recipient (or initiator if active mode */
  134.     UTCTime                            issueTime;                    /*  --> when credentials were issued */
  135.     UTCTime                            expiry;                        /*  --> when credentials expiry */
  136.     RecordIDPtr                        initiator;                    /* <--  RecordID of initiator returned here.
  137.                                             Must give appropriate Buffer to hold RecordID
  138.                                             (Only for passive or accept mode) */
  139.     Boolean                            hasIntermediary;            /* <--  will be set if credentials has an intermediary */
  140.     Boolean                            filler1;
  141.     RecordIDPtr                        intermediary;                /* <--  RecordID of intermediary returned here.
  142.                                             (If intermediary is found in credentials
  143.                                             Must give appropriate Buffer to hold RecordID
  144.                                             (Only for passive or accept mode) */
  145. };
  146. typedef struct TRSecureParams TRSecureParams;
  147.  
  148. typedef struct SDSPParamBlock SDSPParamBlock;
  149.  
  150. typedef SDSPParamBlock *SDSPPBPtr;
  151.  
  152. typedef pascal void (*SDSPIOCompletionProcPtr)(SDSPPBPtr paramBlock);
  153.  
  154. #if GENERATINGCFM
  155. typedef UniversalProcPtr SDSPIOCompletionUPP;
  156. #else
  157. typedef SDSPIOCompletionProcPtr SDSPIOCompletionUPP;
  158. #endif
  159.  
  160. enum {
  161.     uppSDSPIOCompletionProcInfo = kPascalStackBased
  162.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SDSPPBPtr)))
  163. };
  164.  
  165. #if GENERATINGCFM
  166. #define NewSDSPIOCompletionProc(userRoutine)        \
  167.         (SDSPIOCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSDSPIOCompletionProcInfo, GetCurrentArchitecture())
  168. #else
  169. #define NewSDSPIOCompletionProc(userRoutine)        \
  170.         ((SDSPIOCompletionUPP) (userRoutine))
  171. #endif
  172.  
  173. #if GENERATINGCFM
  174. #define CallSDSPIOCompletionProc(userRoutine, paramBlock)        \
  175.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppSDSPIOCompletionProcInfo, (paramBlock))
  176. #else
  177. #define CallSDSPIOCompletionProc(userRoutine, paramBlock)        \
  178.         (*(userRoutine))((paramBlock))
  179. #endif
  180.  
  181. struct SDSPParamBlock {
  182.     struct QElem                    *qLink;
  183.     short                            qType;
  184.     short                            ioTrap;
  185.     Ptr                                ioCmdAddr;
  186.     SDSPIOCompletionUPP                ioCompletion;
  187.     OSErr                            ioResult;
  188.     char                            *ioNamePtr;
  189.     short                            ioVRefNum;
  190.     short                            ioCRefNum;                    /* adsp driver refNum */
  191.     short                            csCode;                        /* adsp driver control code */
  192.     long                            qStatus;                    /* adsp internal use */
  193.     short                            ccbRefNum;                    /* connection end refNum */
  194.     union {
  195.         TRinitParams                    initParams;                /* dspInit, dspCLInit */
  196.         TRopenParams                    openParams;                /* dspOpen, dspCLListen, dspCLDeny */
  197.         TRcloseParams                    closeParams;            /* dspClose, dspRemove */
  198.         TRioParams                        ioParams;                /* dspRead, dspWrite */
  199.         TRattnParams                    attnParams;                /* dspAttention */
  200.         TRstatusParams                    statusParams;            /* dspStatus */
  201.         TRoptionParams                    optionParams;            /* dspOptions */
  202.         TRnewcidParams                    newCIDParams;            /* dspNewCID */
  203.         TRSecureParams                    secureParams;            /* dspOpenSecure */
  204.     } u;
  205. };
  206.  
  207.  
  208. #if PRAGMA_IMPORT_SUPPORTED
  209. #pragma import off
  210. #endif
  211.  
  212. #if PRAGMA_ALIGN_SUPPORTED
  213. #pragma options align=reset
  214. #endif
  215.  
  216. #ifdef __cplusplus
  217. }
  218. #endif
  219.  
  220. #endif /* __ADSPSECURE__ */
  221.